<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin extends Controller {
	
	private $adm_root;

	public function before() {
        if(!isset(Kohana::$config->load('pandrade')->allow_admin) || true !== Kohana::$config->load('pandrade')->allow_admin){
			throw new HTTP_Exception_404();
		}
		parent::before();
		if(!Model_User::logged_in('admin')) {
			$this->request->redirect($this->language."login?redirect=".$this->request->uri());
		}		
		define("ADM_ROOT",$this->adm_root = $this->url_root.Kohana::$config->load('pandrade')->adm_root."/");
		$smarty = new Smarty_View;
		$smarty->bind_global("ADM_ROOT", $this->adm_root);
	}
	
} // End Admin